/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;
import java.sql.*;

/**
 *
 * @author phihai
 */
public class Database {
    private static Connection conn;
       
    public void open(String port,String user ,String pass) throws ClassNotFoundException, SQLException
    {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");      
        String url = "jdbc:sqlserver://localhost:"+port+";databaseName=DBWebCrawler;user="+user+";password="+pass+";";
        conn = DriverManager.getConnection(url);       
    }
    public Connection GetConn()
    {
        return conn;
    }
    
    public void close() throws SQLException
    {
        conn.close();
    }
}
